import java.util.Scanner;

public class homework40 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入西瓜的重量：");
        double weight =sc.nextDouble();
        System.out.println("请输入顾客所付钱数：");
        double price =sc.nextDouble();
        double payment = money(weight);
        double qian = price-Double.parseDouble(String.format("%.2f", payment));
        if (qian<=0){
            double zaifuqian =qian * -1;
            System.out.println("应付货款"+payment+"元，还需再付"+zaifuqian+"元");
        }else {
            System.out.println("应付"+payment+"元，应找"+qian+"元");
        }
    }
    public static double money(double weight){
        if (weight<=5)
            return 1.05*weight;
        else if (weight<=10)
            return 1.00*weight;
        else if (weight<=15)
            return 0.95*weight;
        else if (weight<=20)
            return 0.90*weight;
        else
            return 0.85*weight;
    }
}